package br.com.despesasPlan.dao;

import java.sql.Connection;
import java.sql.SQLException;

import br.com.despesasPlan.jdbc.ConnectionFactory;


public abstract class GenericDao {
	private Connection connection;
	
	protected Connection getConnection() {
		try {
			if (this.connection == null || this.connection.isClosed())
				this.connection = ConnectionFactory.getConnection();
		} catch (SQLException e) {
			throw new RuntimeException("Não foi possível conectar:" + e.getMessage());
		}
		return this.connection;
	}
	
}
